/**
 * 
 */
package com.nc.delivery_project.shared.locator;

import com.google.web.bindery.requestfactory.shared.Locator;
import com.nc.delivery_project.server.domain.City;
import com.nc.delivery_project.server.service.CityService;
import com.nc.delivery_project.shared.servicelocator.CityServiceLocator;


/**
 * @author NataG
 *
 */
public class CityLocator extends Locator<City, Integer> {

	@Override
	public City create(Class<? extends City> arg0) {
		return new City();
	}

	@Override
	public City find(Class<? extends City> arg0, Integer id) {
        return ((CityService) new CityServiceLocator().getInstance(null)).read(id);

	}

	@Override
	public Class<City> getDomainType() {
		return City.class;
	}

	@Override
	public Integer getId(City arg0) {
		return arg0.getCityId();
	}

	@Override
	public Class<Integer> getIdType() {
		return Integer.class;
	}

	@Override
	public Object getVersion(City arg0) {
		return arg0.getCityId();
	}

}
